Not today...

Filed under dev...

comments

Snippet

Viper Multi Config

This post will explain how to overload configurations in Golang using viper and cobra libraries. The use case may be a niche one, but I find this to be an easy to understand and pretty clear way to do configuration merge. The problem and the expectation I am deploying most of my application on Kubernetes nowadays (I also moved my personal infrastructure to it a few weeks ago). This solution come with a big tooling ecosystem and a really opiniated way to deploy. Read More...

Tagged golang , dev , cli

comments

Project

Introducing Janus (SSH Agent written in Go)

Why this project I am currently using gopass to store and share my passwords. I was relying on GPG to handle the encryption side of the process. Then a colleague of mine introduced me to age. This encryption specification allows the use of SSH keys and specifically the ED25519 ones. I decided to make the switch and moved all my stores to age encryption. I am protecting my private key with a password and only loading it inside my agent. Read More...

Tagged dev , golang

comments

Snippet

Golang SSH tunneling

I already did an article around Golang and SSH previously, since it is a huge part of my current work. Today, I will share a small snippet which can be quite handy when automating stuff. This is how to perform a SSH tunnel using Golang. I will not explain what it is or what it is useful for, if you need more details please check the doc. In this tutorial, I will use the official SSH library from Google. Read More...

Tagged dev , golang

comments

Snippet

Golang SSH, marshalling, unmarshalling

Golang is a wonderful language to deal with the SSH protocol. It’s mostly due to the SSH library which is pretty exhaustive. However, when I had to deal with external requirements like SSH Agent or OpenSSH I experienced a lack of example and struggled a bit interfacing. In this article we will see how to exchange keys between a program written in Go and those tools using files. This means to output our keys in a proper format (marshaling) and being able to read them (unmarshalling) from the external tool format. Read More...

Tagged golang , dev

comments

Project

Introducing Y2J (Yaml to Json converter)

This post is only to present a small project and the reasons behind it. Hope it can help other people. Why this project I am massively using jq in my shell scripts to deal with APIs. It is a powerfull tool and really help my day to day work. A few weeks ago I had to do the same kind of operations on a Yaml file, I started looking out there for alternative, and found some tooling which are translating Yaml to Json then push it to jq: here is an example. Read More...

Tagged dev , rust

comments

Snippet

Parallel runners with teardown in go

From time to time in go I have to start multiple small services acting in parallel. For example, a ssh server tied to an administration console (one is running on port 80 the other on port 22), or a kafka consumer pushing to a database and a website to serve those informations. You can decouple this in multiple programs, or run them through some kind of a manager and handle everything at the same place. Read More...

Tagged golang , dev

comments

Snippet

Cancel copy of huge file in Go

I recently came across this video on Golang programming. I think this was the moment I finally fully understood the power of Go. It is smart, simple and elegant, I love it. Then, a few days later, I was coding on a toy project and I was doing some stuff around the io package to copy huge files. I wanted to achieve copy cancelation during the processing, basically, being able to interrupt. Read More...

Tagged dev , golang

comments

Snippet

direnv

I recently discovered the direnv project. Which helped me a lot for setting up my development environments. I will share a bit of things I use in my daily basis. Python projects This is well documented but here is what I use in python projects to set up a default virtualenv. layout python That’s it! It sets up a virtualenv in your .direnv directory, and load the updated PATH. Golang projects This one is a bit trickier. Read More...

Tagged bash , cli , dev

comments

Snippet

Golang err shadowing

A feature I like in golang is the hability to declare a variable at the assignation time. Something like this: foo := "bar" Here the variable foo will automatically set up as a string with the value “bar”. One more feature is to be able to allocate on same line as doing a comparison. Like this: if foo := "bar"; foo == "baz" { // do something } else { // do something else } This is really handy when it comes to catch errors from an other function: Read More...

Tagged golang , dev

comments

Project

vuecc

I recently discovered Vue.js and I really liked it. You just have to add a script tag and you can start coding using this framework. After a few hours of development, I decided to use SFC (Single File Components) to separate business code from components. And I got a really bad surpise! In order to compile those templates I needed to use a build system (Webpack or Browserify). The tutorial is really good, but… Read More...

Tagged dev , javascript